package com.lsq.baseadmin.config;

import com.lsq.baseadmin.common.interceptor.LoginInterceptor;
import com.lsq.baseadmin.common.interceptor.MenuInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author pc12138
 * @since 2020/10/24 12:03
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/static/**", "/", "/auth/**",
                        "/swagger-resources/**",
                        "/swagger-ui.html",
                        "/v2/api-docs",
                        "/webjars/**");

        registry.addInterceptor(new MenuInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/static/**", "/", "/auth/**", "/sys/**",
                        "/swagger-resources/**",
                        "/swagger-ui.html",
                        "/v2/api-docs",
                        "/webjars/**");
    }
}
